package top.frsf.schedule;

import top.frsf.object.env.Sun;
import top.frsf.panel.GamePanel;
import top.frsf.starter.impl.EnvStarter;

import java.util.Timer;
import java.util.TimerTask;

/**
 * 阳光生成定时任务
 *
 * @author FRSF
 * @since 2025/8/1 16:05
 */
public class SumTimeTask extends TimerTask {

    private static final Timer timer = new Timer();

    @Override
    public void run() {
        EnvStarter starter = GamePanel.starterContext.getStarter(EnvStarter.class);
        starter.getSuns().add(Sun.getRandomSunObj());
    }

    public static void start() {
        timer.schedule(new SumTimeTask(), 10000, 10000);
    }
}
